<?php

require_once 'system/config.php';

$accessPage = accessPage::getConn();

$func = new functions;

$username = $func->post_isset('usuario')->anti_sql_injection()->get();
$password = $func->post_isset('senha')->anti_sql_injection()->get();

    if($password == "123456"){
        $func->go("trocaSenha.php?usuario=$username");
    }
    else{
            $busca = new gestaoSistema();

            $res = $accessPage->select_fields("SELECT * FROM inf_empresa");

            
                if(empty($res[0]["id"]))
                    $page_success = 'home.php?pg=infoEmpresa&action=inc';
                else
                    $page_success = 'home.php';
                
       
        $page_fail = "index.php";
        
         //campo BD   => //valor valido
        $array_validation = array('codigo'=>$username,
                                  'senha'=>$password,
                                  'situacao'=>'Ativo'
                                 );

        $accessPage->accessValidation(USUARIOS, $page_success, $page_fail, $array_validation);
}

?>
